package com.winchain.chainbill.bill.biz.receive.cmd;

import com.shell.bee.acct.transaction.po.AcctTxRec;
import com.shell.framework.command.CallbackContext;
import com.shell.framework.command.ICallback;
import com.winchain.chainbill.bill.base.po.CbRcv;
import com.winchain.chainbill.bill.base.po.CbRec;
import com.winchain.chainbill.bill.biz.Bill;
import com.winchain.chainbill.bill.biz.receive.service.BillCertService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class BillCertCmd implements ICallback<Bill<CbRcv>, AcctTxRec> {
	@Autowired
	private BillCertService billCertService;

	public boolean callback(CallbackContext<Bill<CbRcv>, AcctTxRec> context) throws Exception {
		CbRcv cbRcv = (CbRcv) ((Bill) context.getSource()).getSource();
		CbRec cbRecord = ((Bill) context.getSource()).getRec();

		this.billCertService.cert(cbRecord, cbRcv);

		return false;
	}
}
